package com.qf.springbootproject.config;

import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ShiroConfig {
    @Bean
    public ShiroFilterChainDefinition shiroFilterChainDefinition() {
        DefaultShiroFilterChainDefinition definition = new DefaultShiroFilterChainDefinition();
        definition.addPathDefinition("/swagger-ui.html", "anon");
        definition.addPathDefinition("/v2/api-docs", "anon");
        definition.addPathDefinition("/swagger-resources/**", "anon");
        definition.addPathDefinition("/webjars/springfox-swagger-ui/**", "anon");
        definition.addPathDefinition("/**", "authc");
        return definition;
    }

    @Bean
    public Realm realm() {
        CustomRealm customRealm = new CustomRealm();


        return customRealm;
    }
}
